package com.zzxx.mapper;

import com.zzxx.entity.ActivitySchedule;
import com.zzxx.entity.ActivityScheduleExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface ActivityScheduleMapper {
    @SelectProvider(type=ActivityScheduleSqlProvider.class, method="countByExample")
    long countByExample(ActivityScheduleExample example);

    @DeleteProvider(type=ActivityScheduleSqlProvider.class, method="deleteByExample")
    int deleteByExample(ActivityScheduleExample example);

    @Delete({
        "delete from activityschedule",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    @Insert({
        "insert into activityschedule (id, activityId, ",
        "startTime, endTime, ",
        "freeNum, Adate)",
        "values (#{id,jdbcType=VARCHAR}, #{activityid,jdbcType=VARCHAR}, ",
        "#{starttime,jdbcType=TIMESTAMP}, #{endtime,jdbcType=TIMESTAMP}, ",
        "#{freenum,jdbcType=INTEGER}, #{adate,jdbcType=TIMESTAMP})"
    })
    int insert(ActivitySchedule row);

    @InsertProvider(type=ActivityScheduleSqlProvider.class, method="insertSelective")
    int insertSelective(ActivitySchedule row);

    @SelectProvider(type=ActivityScheduleSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="activityId", property="activityid", jdbcType=JdbcType.VARCHAR),
        @Result(column="startTime", property="starttime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="endTime", property="endtime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="freeNum", property="freenum", jdbcType=JdbcType.INTEGER),
        @Result(column="Adate", property="adate", jdbcType=JdbcType.TIMESTAMP)
    })
    List<ActivitySchedule> selectByExample(ActivityScheduleExample example);

    @Select({
        "select",
        "id, activityId, startTime, endTime, freeNum, Adate",
        "from activityschedule",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="activityId", property="activityid", jdbcType=JdbcType.VARCHAR),
        @Result(column="startTime", property="starttime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="endTime", property="endtime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="freeNum", property="freenum", jdbcType=JdbcType.INTEGER),
        @Result(column="Adate", property="adate", jdbcType=JdbcType.TIMESTAMP)
    })
    ActivitySchedule selectByPrimaryKey(String id);

    @UpdateProvider(type=ActivityScheduleSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("row") ActivitySchedule row, @Param("example") ActivityScheduleExample example);

    @UpdateProvider(type=ActivityScheduleSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("row") ActivitySchedule row, @Param("example") ActivityScheduleExample example);

    @UpdateProvider(type=ActivityScheduleSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(ActivitySchedule row);

    @Update({
        "update activityschedule",
        "set activityId = #{activityid,jdbcType=VARCHAR},",
          "startTime = #{starttime,jdbcType=TIMESTAMP},",
          "endTime = #{endtime,jdbcType=TIMESTAMP},",
          "freeNum = #{freenum,jdbcType=INTEGER},",
          "Adate = #{adate,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(ActivitySchedule row);
}